#pragma once
#include <stdio.h>

#ifndef WOWDEBUG
    #define WOWDEBUG
#endif

template<class C> 
bool save_array_2D(const char* filename, const C *data, int h, int w) {
    FILE *fp = NULL;
    fopen_s(&fp, filename, "w");
    if (fp) {
        for (int i = 0; i != h; ++i) {
            for (int j = 0; j != w; ++j) {
                int k = i*w + j;
                fprintf_s(fp, "%f ", static_cast<float>(data[k]));
            }
            fprintf_s(fp, "\n");
        }
        fclose(fp);
        return true;
    }
    return false;
}
